import { getAction, postAction } from '@/api/manage'
import { serviceApi } from '@/api/common.js'

/**
 * 公共API接口
 */
export const api = {
}

/**
 * 获取部门应用权限
 * @param params
 * @returns {AxiosPromise}
 */
export const queryDepartAppPermission = (appId, params) => getAction(serviceApi.auth + `/departs/permissions/apps/${appId}`, params)

/**
 * 部门管理 获取树形结构部门应用权限
 * @param departId
 * @param params {departId:''}
 * @returns {AxiosPromise}
 */
export const queryDepartAppTree = (params) => getAction(serviceApi.auth + '/departs/permissions/apps', params)

/**
 * 保存部门权限
 * @param params
 * @returns {AxiosPromise}
 */
export const saveDepartPermission = params => postAction(serviceApi.auth + '/departs/permissions', params)

/**
 * 获取部门权限数据规则
 * @param {*} params
 * @returns
 */
export const loadDepartPermissionDataRule = (permissionId, params) => getAction(serviceApi.auth + `/departs/permissions/${permissionId}/data-rules`, params)

/**
 * 保存部门权限数据规则
 * @param {*} params
 * @returns
 */
export const saveDepartPermissionDataRule = params => postAction(serviceApi.auth + '/departs/permissions/data-rules', params)
